<?php
/*
 * Created on 20 mars 2009
 * Created by Ludovic Reenaers
 * lreenaers@hotmail.com
 */
 class Token{
 	private $id;
 	private $name;
 	function __construct($id) {
 		if (is_int($id)){
 			if($id > 0){
				$this->id=$id;
 			}else{
 				throw new Exception("id must be superior to 0");
 			}
 		}else{
 			throw new Exception("id must be integer");
 		}
	}
	function setName($name){
		if(is_string($name)){
			
			if(str_replace(" ","",$name) != ""){
				if(strlen($name) > 0 and strlen($name) < 101){
					$this->name  =$name;
				}else{
					throw new Exception("name length could be 1 to 100 char");
				}
			}else{
				throw new Exception("name could not be empty string");	
			}
		}else{
			throw new Exception("name must be a string");
		}
	}
	function getId(){
		return $this->id;
	}
	function getName(){
		return $this->name;
	}

 }
?>
